<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      beforeunloadTime: 0,
      unloadTime: 0
    };
  },
  mounted() {
    window.addEventListener('beforeunload', e => this.beforeunloadHandler(e));
    window.addEventListener('unload', e => this.unload(e));
  },
  destroyed() {
    window.removeEventListener('beforeunload', e => this.beforeunloadHandler(e));
    window.removeEventListener('unload', e => this.unload(e));
  },
  methods: {
    beforeunloadHandler() {
      this.beforeunloadTime = new Date().getTime()
    },
    unload() {
      this.unloadTime = new Date().getTime()
      // 本地通过localStorage中的数据看出,关闭事件间隔小于1,刷新则大于8
      if (this.unloadTime - this.beforeunloadTime <= 1) {
        // 执行退出登录
        this.$store.dispatch('user/logout')
      }
    }
  }
}
</script>
<style lang="scss">
.user-dropdown{
  top:50px !important;
  // left: 1315px !important;
}
.user-dropdown .el-dropdown-menu__item{
  line-height: 20px !important;
}

.fn-clear:after {
  visibility: hidden;
  display: block;
  font-size: 0;
  content: " ";
  clear: both;
  height: 0;
}

.fn-clear {
  zoom: 1; /* for IE6 IE7 */
}
.avue-checkbox .el-checkbox, .avue-radio .el-radio {
    margin-right: 20px;
}
.jurisdiction_dialog .el-dialog .el-select .el-select__tags{
  height: auto;
  max-height: 300px;
  overflow: scroll;
}
.menu_dialog .el-dialog .el-select .el-select__tags{
  height: auto;
  max-height: 300px;
  overflow: scroll;
}
.avue-dynamic__header{
  padding-left: 0 !important;
}
.avue-dynamic__row .el-form-item__content button{
  display: none;
}
.avue-dynamic__row .el-form-item__content button.is-circle{
  display: block;
}
.el-image-viewer__wrapper {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 20%;
}
.el-image-viewer__mask {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 1;
  background: #cbcbcb;
}
</style>
